﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TurtleLib.ComputerCraft
{
  public partial class Computer : IBootablePeripheral
  {
    protected Term _term;
    protected PeripheralUtility _peripheral;
    protected OperatingSystem _os;

    public Computer() : this(new Term(51, 19))
    {
    }

    protected Computer(Term customTerm)
    {
      _term = customTerm;
      _peripheral = new PeripheralUtility();
      _os = new OperatingSystem();
    }

    /// <summary>
    /// Turn the computer on
    /// </summary>
    public void turnOn()
    {
      _term.clear();
      var osaccess = new OperatingSystem.OperatingSystemAccess(_os);
      osaccess.Boot();
    }

    /// <summary>
    /// Shutdown the computer
    /// </summary>
    public void shutdown()
    {
      throw new NotImplementedException();
    }

    /// <summary>
    /// Reboot the computer
    /// </summary>
    public void reboot()
    {
      shutdown();
      turnOn();
    }

    /// <summary>
    /// Get a unique identifier for the computer
    /// </summary>
    /// <returns>ID</returns>
    public int getID()
    {
      throw new NotImplementedException();
    }
  }
}
